﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.ReinforceLab.AudioModem.LinkLayer
{/*
    class PulseWidthCounterFilter
    {
        #region Variables
        int _prevSig;
        int _pulseWidth;
        #endregion

        #region Constructor
        public PulseWidthCounterFilter()
        {
            _prevSig    = 0;
            _pulseWidth = 0;
        }
        #endregion

        #region Public methods
        public int [] Filter(int[] waveform)
        {
            var demod_sig = new List<int>();
            foreach (var sig in waveform)
            {
                _pulseWidth++;
                if (_prevSig != sig && _prevSig == -1)
                {                    
                    _pulseWidth = 0;
                }
                _prevSig = sig;
                demod_sig.Add(Math.Min(6, _pulseWidth));
            }

            return demod_sig.ToArray();
        }
        #endregion
    }*/
}
